using System;
using System.Windows.Input;
using XEvolve.Core.Runtime;
using XEvolve.Presentation.Input;

namespace XEvolve.Presentation.Test
{
    internal class StubICommandHandler : ICommandHandler
    {
        public bool Executed { get; set; }
        public bool Executeable { get; set; }

        public void Execute(object sender, object parameter)
        {
            Executed = true;
        }

        public bool CanExecute(object sender, object parameter)
        {
            var canExecute = parameter is bool ? (bool) parameter : true;
            return canExecute;
        }
    }

    internal class StubCommandHandler
    {
        public bool Executed { get; set; }
        public bool Executeable { get; set; }

        public void Execute(object sender, ExecutedRoutedEventArgs e)
        {
            Executed = true;
        }

        public void CanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            e.CanExecute = Executeable;
        }
    }

    internal class AnotherStubHandler : ICommandHandler
    {
        public bool Executed { get; set; }
        public bool Executeable { get; set; }

        public void Execute(object sender, object parameter)
        {
            Executed = true;
        }

        public bool CanExecute(object sender, object parameter)
        {
            return Executeable;
        }
    }

    internal class StubRoutedCommand : RoutedCommand
    {
    }

    internal class StubICommand : ICommand
    {
        public bool Executed { get; set; }

        public bool Executable { get; set; }

        public event EventHandler CanExecuteChanged;

        public void Execute(object parameter)
        {
            Executed = true;
        }

        public bool CanExecute(object parameter)
        {
            return Executable;
        }
    }

    internal abstract class TestPlatform : Platform
    {
        public static Platform Create()
        {
            return CreateDefault();
        }
    }
}
